<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>随机切换页面颜色</title>
    <script src="mytool.js"></script>
</head>

<body>
    <button id="btn">随机切换颜色</button>

    <script>
        setInterval(function () {
            var r = randomIntegers(0, 255)
            var g = randomIntegers(0, 255)
            var b = randomIntegers(0, 255)
            var str = 'rgb(' + r + ',' + g + ',' + b + ')'
            document.body.style.backgroundColor = str
        }, 1000)
    </script>
</body>

</html>